home *** CD-ROM | disk | FTP | other *** search
- 144
- --- RECORDSEPARATOR ---
-
- --- RECORDSEPARATOR ---
- FindFirstFile
- --- RECORDSEPARATOR ---
- Platform:
- --- RECORDSEPARATOR ---
-
- --- RECORDSEPARATOR ---
- Windows and Macintosh
- --- RECORDSEPARATOR ---
-
- --- RECORDSEPARATOR ---
- Description:
- --- RECORDSEPARATOR ---
-
- --- RECORDSEPARATOR ---
- baFindFirstFile searches for the first file matching a specification.
- --- RECORDSEPARATOR ---
-
- --- RECORDSEPARATOR ---
- Usage:
- --- RECORDSEPARATOR ---
-
- --- RECORDSEPARATOR ---
- Result = baFindFirstFile( StartDir, FileSpec )
- --- RECORDSEPARATOR ---
-
- --- RECORDSEPARATOR ---
- A
- --- RECORDSEPARATOR ---
- rguments:
- --- RECORDSEPARATOR ---
-
- --- RECORDSEPARATOR ---
- String, string.
- --- RECORDSEPARATOR ---
- StartDir is the directory to start searching in.
- --- RECORDSEPARATOR ---
- FileSpec is the pattern to search for.
- --- RECORDSEPARATOR ---
-
- --- RECORDSEPARATOR ---
- Returns:
- --- RECORDSEPARATOR ---
-
- --- RECORDSEPARATOR ---
- String
- --- RECORDSEPARATOR ---
- Returns the full path to the first file found
- --- RECORDSEPARATOR ---
-
- --- RECORDSEPARATOR ---
- Examples:
- --- RECORDSEPARATOR ---
-
- --- RECORDSEPARATOR ---
- Director:
- --- RECORDSEPARATOR ---
- set file = baFindFirstFile( "c:\", "netscape.exe" )
- --- RECORDSEPARATOR ---
- -- searches drive c for Netscape
- --- RECORDSEPARATOR ---
- Authorware:
- --- RECORDSEPARATOR ---
- file := baFindFirstFile( "c:\\windows", "*.ttf" )
- --- RECORDSEPARATOR ---
- -- searches for fonts
- --- RECORDSEPARATOR ---
-
- --- RECORDSEPARATOR ---
- Notes:
- --- RECORDSEPARATOR ---
-
- --- RECORDSEPARATOR ---
- All sub-directories of the starting directory will be included in the search. This
- --- RECORDSEPARATOR ---
- function can be used with baFindNextFile to f
- --- RECORDSEPARATOR ---
- ind all files. On
- --- RECORDSEPARATOR ---
- Windows
- --- RECORDSEPARATOR ---
- , when you
- --- RECORDSEPARATOR ---
- are finished finding all the files you are interested in, you must call baFindClose to
- --- RECORDSEPARATOR ---
- free memory allocated by baFindFirstFile. This is not necessary - but can be
- --- RECORDSEPARATOR ---
- included - on
- --- RECORDSEPARATOR ---
- Macintosh
- --- RECORDSEPARATOR ---
- .
- --- RECORDSEPARATOR ---
- Here are examples of searching the C drive for all copies of "netscape.exe"
- --- RECORDSEPARATOR ---
-
- --- RECORDSEPARATOR ---
- Director:
- --- RECORDSEPARATOR ---
-
- --- RECORDSEPARATOR ---
- set fileList = []
- --- RECORDSEPARATOR ---
- -- a list to contain the found files
- --- RECORDSEPARATOR ---
- set file = baFindFirstFile( "c:\", "netscape.exe" )
- --- RECORDSEPARATOR ---
- repeat while file <> ""
- --- RECORDSEPARATOR ---
- -- loop through all found files and add to the list
- --- RECORDSEPARATOR ---
- append( fileList, file )
- --- RECORDSEPARATOR ---
- set file = baFindNextFile()
- --- RECORDSEPARATOR ---
- end repeat
- --- RECORDSEPARATOR ---
- baFindClose()
- --- RECORDSEPARATOR ---
-
- --- RECORDSEPARATOR ---
- Authorware Xtra:
- --- RECORDSEPARATOR ---
-
- --- RECORDSEPARATOR ---
- fileList := []
- --- RECORDSEPARATOR ---
- -- a list to contain the found files
- --- RECORDSEPARATOR ---
- file := baFindFirstFile( "c:\\", "netscape.exe" )
- --- RECORDSEPARATOR ---
- repeat while file <> ""
- --- RECORDSEPARATOR ---
- AddLinear( fileList, file )
- --- RECORDSEPARATOR ---
- file := baFindNextFile()
- --- RECORDSEPARATOR ---
- end repeat
- --- RECORDSEPARATOR ---
- baFindClose()
- --- RECORDSEPARATOR ---
-
- --- RECORDSEPARATOR ---
- Authorware UCD:
- --- RECORDSEPARATOR ---
-
- --- RECORDSEPARATOR ---
- fileList := ""
- --- RECORDSEPARATOR ---
- file := baFindFirstFile( "c:\\", "netscape.exe" )
- --- RECORDSEPARATOR ---
- repeat while file <> ""
- --- RECORDSEPARATOR ---
- if fileList = "" then
- --- RECORDSEPARATOR ---
- -- add names to fileList with returns between file names
- --- RECORDSEPARATOR ---
- fileList := file
- --- RECORDSEPARATOR ---
- else
- --- RECORDSEPARATOR ---
- fileList := fileList ^ Return ^ file
- --- RECORDSEPARATOR ---
- end if
- --- RECORDSEPARATOR ---
- -- get next file
- --- RECORDSEPARATOR ---
- file := baFindNextFile()
- --- RECORDSEPARATOR ---
- end repeat
- --- RECORDSEPARATOR ---
- baFindClose()